package com.xu.service;

import com.xu.mapper.ProductMapper;
import com.xu.pojo.Product;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductServiceImpl implements ProductService {

    @Autowired
    private ProductMapper productMapper;

    public void setProductMapper(ProductMapper productMapper) {
        this.productMapper = productMapper;
    }

    public List<Product> queryAllProduct() {
        return productMapper.queryAllProduct();
    }

    public Product queryProductById(int id)
    {
        return productMapper.queryProductById(id);
    }

    public int addProduct(Product product)
    {
        return productMapper.addProduct(product);
    }

    public int delProduct(int id) {
        return productMapper.delProduct(id);
    }

    public int updProduct(Product product) {
        return productMapper.updProduct(product);
    }

    public int selectProductNum()
    {
        return productMapper.selectProductNum();
    }


}
